package com.cicc.beergamevirtualsimulationsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cicc.beergamevirtualsimulationsystem.common.enums.roomEnum.Status;
import com.cicc.beergamevirtualsimulationsystem.entity.RoleBindingEntity;
import com.cicc.beergamevirtualsimulationsystem.mapper.RoleBindingMapper;
import com.cicc.beergamevirtualsimulationsystem.model.room.dto.QueryRoomRecordDto;
import com.cicc.beergamevirtualsimulationsystem.service.RoleBindingService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class RoleBindingServiceImpl extends ServiceImpl<RoleBindingMapper, RoleBindingEntity> implements RoleBindingService {

    private final RoleBindingMapper roleBindingMapper;
    /**
     * 查询当前玩家参与了哪些已经结束的游戏
     *
     * @param userId
     * @return
     */
    @Override
    public List<QueryRoomRecordDto> queryRoomRecord(String userId) {
        List<QueryRoomRecordDto> queryRoomRecordDtos = roleBindingMapper.queryRoomRecord(userId, Status.ENDED.getCode());
        return queryRoomRecordDtos;
    }
}
